import 'reflect-metadata'
import { LoginController, CrowllerController } from '../controller'
import { RequestHandler } from 'express'
export function use(middleware: RequestHandler) {
  return function (target: LoginController | CrowllerController, key: string) {
    const originMiddleware = Reflect.getMetadata('middlewares', target, key) || []
    originMiddleware.push(middleware)
    Reflect.defineMetadata('middlewares', originMiddleware, target, key)
  }
}
